const cloud = require('wx-server-sdk')
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
})
exports.main = async (event, context) => {
  const db = cloud.database()
  const {
    signId
  } = event
  try {
    // 1. 执行添加
    const data = await db.collection('active_user').doc(signId)
      .field({
        _id: true,
        active_name: true,
        active_id: true,
        nickName: true,
        real_name: true,
        isRevoke: true,
        deleteAt: true,
        isDeleted: true,
      }) // 按需获取字段
      .get()
    return {
      code: 200,
      message: '查看成功',
      data: data
    }
  } catch (err) {
    console.error(err)
    return {
      code: 500,
      message: '服务器错误'
    }
  }
}